const a = [2, 3, 1, 6];
const s = new Set(a);

a.forEach((v, i) => console.log(`${i},${v};`)); // 0,2;1,3;2,1;3,6;
console.log(new Array(10).join("-"));
s.forEach((v, i) => console.log(`${i},${v};`)); // 2,2;3,3;1,1;6,6;
